
import excel "Rent_PCE (Figure A9).xlsx", sheet("PCECA") firstrow clear

rename PCECA pce
gen year = year(DATE)

collapse (mean) pce, by(year)
sort year

tempfile temp
save `temp'

import excel "Rent_PCE (Figure A9).xlsx", sheet("CUUR0000SEHA") firstrow clear

rename CUUR0000SEHA rent
gen year = year(DATE)
drop if rent == 0

collapse (mean) rent, by(year)
sort year

merge year using `temp'

************************************************************************
* Data Work
************************************************************************

gen delta_rent = (rent - rent[_n-1]) / rent[_n-1]
gen delta_pce  = (pce - pce[_n-1]) / pce[_n-1]

drop if year < 1929

tsset year
twoway (tsline delta_rent) (tsline delta_pce, lpattern(dash)), scheme(s1mono) yline(0) xlabel(1930(10)2010) xtitle("") legend(label(1 "Rent Growth") label(2 "PCE Growth")) ytitle(Percent) name(fig1, replace) 
twoway (scatter delta_rent delta_pce) (lfit delta_rent delta_pce), yline(0) xline(0) xtitle("PCE Growth (%)") ytitle("Rent Growth (%)") scheme(s1mono) legend(off) name(fig2, replace)

graph combine fig1 fig2, ysize(8) row(2) scheme(s1mono)

graph export "US_PCE_Rent.pdf", replace 			


